<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
		<style>
			.d {
				width: 200px;
				height: 200px;
				border: 1px solid cadetblue;
			}
		</style>
		<script>
			/*
						alert("1")
						if (document.getElementById("d11").parentNode) { //得到父节点
							alert("2")
							document.getElementById("d11").parentNode.removeChild(document.getElementById("d11")); //得到父节点,并删除父节点下的子节点
						} 
						
						var a = document.getElementById("b2").previousSibling.id; //得到当前节点的同级前一个节点
						alert(document.getElementById("b2").previousSibling.id);
						alert(a);
						
						
			         */

			$(function() {//"主函数",html加载完执行

				var a = 1;
				document.getElementById("d1").textContent='<p>goodBy</p>';
				alert(a);
			});
		</script>

	</head>

	<body>
		<div id="d">
			<div id="d1" class="d">d1--
				<a>我是连接</a>
			</div>
			<div id="d2" class="d">d2--
                <p>goodBy</p>
			</div>
			<a id="d11" class="d">1

		</a>
			<a id="d22" class="d">2

		</a>
		</div>
		<div>

		</div>
	</body>

</html>
<script type="text/javascript" src="js/t1.js"></script>